package com.scofield.mybatisplus.controller;


import com.scofield.mybatisplus.entity.User;
import com.scofield.mybatisplus.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 用户 前端控制器
 * </p>
 *
 * @author scofield
 * @since 2020-06-11
 */
@RestController
@RequestMapping("/mybatisplus/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("insert")
    public List<User> insert(){
        User user = new User();
        user.setName("二狗");
        user.setIntro("职业法师");
        userService.save(user);
        return userService.list(null);
    }

}

